/*
 * 字典树模板复习， 最大异或和
 * */

#include <iostream>
#include <algorithm>

using namespace std;

const int N = 3100010;
int nex[N][2], exist[N], s[N], cnt, n, m;

void insert(int x, int d) {
    int p = 0;
    for (int i = 30; i >= 0; --i) {
        int c = x >> i & 1;
        if (!nex[p][c]) {
            nex[p][c] = ++cnt;
        }
        p = nex[p][c];
        exist[p] += d;
    }
}

int find(int x) {
    int res = 0, p = 0;
    for (int i = 30; i >= 0; --i) {
        int c = x >> i & 1;
        if (exist[nex[p][!c]]) {
            p = nex[p][!c], res = res * 2 + 1;
        } else {
            p = nex[p][c], res *= 2;
        }
    }

    return res;
}

int main() {

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n >> m;

    for (int i = 1; i <= n; ++i) {
        cin >> s[i];
        s[i] ^= s[i - 1];
    }

    insert(s[0], 1);
    int res = 0;

    for (int i = 1; i <= n; ++i) {
        if (i - m - 1 >= 0) {
            insert(s[i - m - 1], -1);
        }
        res = max(res, find(s[i]));
        insert(s[i], 1);
    }
    cout << res << endl;
    return 0;
}